package com.zzyl.mapper;

import com.zzyl.entity.Device;
import com.zzyl.vo.DeviceDataGraphVo;
import com.zzyl.vo.DeviceVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import com.github.pagehelper.Page;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface DeviceMapper {
    @Select("select count(1) from device where device_name=#{deviceName}")
    int registerDevice(String deviceName);

    void insert(Device device);


    Page<DeviceVo> pageQueryDevice(String deviceName, String productKey, Integer locationType);

    DeviceVo queryDeviceDetail(String iotId);

    void updateById(Device device);

    void deleteById(String iotId);

    DeviceVo getDeviceByIotId(String iotId);

    List<DeviceDataGraphVo> queryDeviceDataListByDay(@Param("iotId") String iotId,@Param("functionId") String functionId,@Param("startData") LocalDateTime startData,@Param("endData") LocalDateTime endData);

    List<DeviceDataGraphVo> queryDeviceDataListByweek(@Param("iotId")String iotId,@Param("functionId") String functionId,@Param("startData") LocalDateTime startData,@Param("endData") LocalDateTime endData);

    List<Long> selectNuringIdByIotId(String iotId);

    List<Long> selectNuringIdByBed(String iotId);
}
